import { useState, useMemo, useEffect } from 'react';

function Memo() {
	const [age, setAge] = useState(16);


	let age2 = useMemo(() => {
		console.log("11111");
		return age < 18 ? '未成年' : '成年';
	}, [age <= 18])

	useEffect(() => {
		console.log("useEffect");
	})
	console.log('组建跟新')
	return (
		<div>
			年龄: {age} <br />
			阶段: {age2} <br />
			<button onClick={() => {
				setAge(age + 1);
			}}>新增</button>
		</div >
	)
}

export default Memo;